package com.itheima.sevrice.impl;

import com.itheima.dao.AccountDao;
import com.itheima.sevrice.AccountSevrice;
import com.itheima.sevrice.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 杰哥不要啦~
 * @date 2021/9/14
 */
@Service
public class AccountSevriceImpl implements AccountSevrice {

    @Autowired
    private AccountDao accountDao;

 @Autowired
 private LogService logService;

    public void transfer(String out, String in, Double money) {

        try {
            accountDao.outMoney(out,money);
            accountDao.inMoney(in,money);
        } finally {
            logService.log(out, in, money);
        }

    }
}
